package gameserver.services;

import gameserver.model.gameobjects.Monster;
import gameserver.model.group.PlayerGroup;
import gameserver.model.templates.spawn.SpawnTemplate;
import gameserver.spawn.SpawnEngine;

/**
 * @Made By TEAM LX
 */

public class BeshmundirInstanceService
{
    public void onGroupReward(Monster monster, PlayerGroup group)
    {
        // When kills Captain Lakhara spawn other Bosses
        if(monster.getObjectTemplate().getTemplateId() == 216238)
        {
            SpawnTemplate soulcaller, manadar, Plaguebearer, Vehala, Virhana, Dorakiki, Chopper, Fixit, Hakiki, Taros;
            
            soulcaller = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216159, 1356f, 388f, 249f, (byte)89, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(soulcaller, group.getGroupLeader().getInstanceId());

            manadar = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216160, 1085f, 621f, 234f, (byte)89, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(manadar, group.getGroupLeader().getInstanceId());
            
            Plaguebearer = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216163, 1052f, 83f, 233f, (byte)0, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Plaguebearer, group.getGroupLeader().getInstanceId());
            
            Vehala = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216162, 1101f, 34f, 234f, (byte)30, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Vehala, group.getGroupLeader().getInstanceId());
            
            Virhana = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216165, 1215f, 659f, 250f, (byte)89, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Virhana, group.getGroupLeader().getInstanceId());
            
            Dorakiki = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216169, 1176.92f, 1216.06f, 282.93f, (byte)106, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Dorakiki, group.getGroupLeader().getInstanceId());
            
            Chopper = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 281649, 1174.67f, 1213.71f, 283.52f, (byte)106, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Chopper, group.getGroupLeader().getInstanceId());
            
            Fixit = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 281647, 1172.36f, 1211.63f, 283.5f, (byte)106, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Fixit, group.getGroupLeader().getInstanceId());
            
            Hakiki = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 281648, 1170.65f, 1210.18f, 283.61f, (byte)108, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Hakiki, group.getGroupLeader().getInstanceId());
            
            Taros = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216167, 1400.43f, 1284.99f, 302.75f, (byte)103, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Taros, group.getGroupLeader().getInstanceId());
        }
		
        //When kills The Soulcaller spawn Plegeton Boatman, Shadowshift and Thurzon the Undying
        if(monster.getObjectTemplate().getTemplateId() == 216159)
        {
            SpawnTemplate Boatman, Shadowshift, Thurzon;
			
            Boatman = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 799517, 1033.3646f, 314.71857f, 222.1381f, (byte)21, 0, 0, true); //Plegeton Boatman
            SpawnEngine.getInstance().spawnObject(Boatman, group.getGroupLeader().getInstanceId());
                        
            Shadowshift = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216166, 1394f, 458f, 243f, (byte)47, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Shadowshift, group.getGroupLeader().getInstanceId());

            Thurzon = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216525, 1398f, 532f, 241f, (byte)60, 0, 0, true);
            SpawnEngine.getInstance().spawnObject(Thurzon, group.getGroupLeader().getInstanceId());
        }
        
        //When kills Brutal Soulwatcher spawn Plegeton Boatman1
        if(monster.getObjectTemplate().getTemplateId() == 216583) // island 1
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 799518, 933f, 444f, 220f, (byte)0, 0, 0, true); //Plegeton Boatman1
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kill Brutal Soulwatcher spawn Plegeton Boatman2
        else if(monster.getObjectTemplate().getTemplateId() == 216584)// island 2
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 799519, 788f, 442f, 220f, (byte)0, 0, 0, true); //Plegeton Boatman2
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kill Brutal Soulwatcher spawn Plegeton Boatman3
        else if(monster.getObjectTemplate().getTemplateId() == 216585)// island 3
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 799520, 817f, 276f, 220f, (byte)0, 0, 0, true); //Plegeton Boatman2
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
        
        //When kills 15 Warrior Monuments spawn Macunbello
        if(monster.getObjectTemplate().getTemplateId() == 216739) 
		{
            group.setInstanceKills(group.getInstanceKills() + 1);
            
            if (group.getInstanceKills() == 15){
                SpawnTemplate Ahbana;
                Ahbana = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216735, 981f, 134f, 241f, (byte)31, 0, 0, true); //Macunbello
                SpawnEngine.getInstance().spawnObject(Ahbana, group.getGroupLeader().getInstanceId());
            }
        }
		
		// When kills Macunbello spawn Ahbana the Wicked
        else if(monster.getObjectTemplate().getTemplateId() == 216735) //Macunbello
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216158, 1356f, 96f, 247f, (byte)89, 0, 0, true); //Ahbana the Wicked
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		// When kills Taros spawn Gatekeeper Darfall
        else if(monster.getObjectTemplate().getTemplateId() == 216167) //Taros
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216170, 1494.1436f, 1500.9998f, 300.33008f, (byte)77, 0, 0, true); //Gatekeeper Darfall
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
        
        //When kills a Gatekeeper spawn Protector Pahraza
        if(monster.getObjectTemplate().getTemplateId() == 216170) //Gatekeeper Darfall
        {
            SpawnTemplate spawn;
			
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216175, 1434.53f, 1584.14f, 305.825f, (byte)98, 0, 0, true); // Protector Pahraza (meditation chamber)
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }

		//When kills Protector Pahraza spawn Gatekeeper Kutarrun
        else if(monster.getObjectTemplate().getTemplateId() == 216175)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216171, 1394.33f, 1451.41f, 307.793f, (byte)119, 0, 0, true); //Gatekeeper Kutarrun
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }

		//When kills Gatekeeper Kutarrun spawn Protector Dinata
        else if(monster.getObjectTemplate().getTemplateId() == 216171)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216177, 1501.43f, 1593.96f, 329.945f, (byte)89, 0, 0, true); //Protector Dinata (Contemplation chamber)
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kills Protector Dinata spawn Gatekeeper Rhapsharr 
        else if(monster.getObjectTemplate().getTemplateId() == 216177)
        {
            SpawnTemplate spawn;
                                    
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216173, 1573.23f, 1426.84f, 304.66f, (byte)54, 0, 0, true); //Gatekeeper Rhapsharr
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kills Gatekeeper Rhapsharr spawn Judge Kramaka
        else if(monster.getObjectTemplate().getTemplateId() == 216173)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216181, 1640.2f, 1428.82f, 305.835f, (byte)57, 0, 0, true); //Judge Kramaka (petition chamber)
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kills Judge Kramaka spawn Gatekeeper Samarrn
        else if(monster.getObjectTemplate().getTemplateId() == 216181)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216172, 1522.82f, 1353.76f, 307.793f, (byte)33, 0, 0, true); //Gatekeeper Samarrn
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kills Gatekeeper Samarrn spawn Protector Narma
         else if(monster.getObjectTemplate().getTemplateId() == 216172)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216179, 1631.57f, 1495.91f, 329.945f, (byte)66, 0, 0, true); //Protector Narma (Suplication chamber)
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
		
		//When kills Protector Narma spawn Mystery Box and Isbariya the Resolute Boss
        else if(monster.getObjectTemplate().getTemplateId() == 216179)
        {
            SpawnTemplate spawn, box;
                                    
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216182, 1603.43f, 1593.01f, 307.034f, (byte)77, 0, 0, true); //Isbariya the Resolute Boss
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
                                    
            box = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216764, 1544.95f, 1516.64f, 304.6232f, (byte)17, 0, 0, true); //Mystery Box
            SpawnEngine.getInstance().spawnObject(box, group.getGroupLeader().getInstanceId());
        }
        
        //When kills Isbariya the Resolute spawn orb to Stormwing and Stormwing
        if(monster.getObjectTemplate().getTemplateId() == 216182)
        {
            SpawnTemplate Orb, Stormwing;
            
            Orb = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 730275, 1611.1663f, 1604.7267f, 310.30187f, (byte)0, 0, 0, true); //Rift Orb
            SpawnEngine.getInstance().spawnObject(Orb, group.getGroupLeader().getInstanceId());
			
            Stormwing = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 216183, 556.59375f, 1367.2274f, 224.79459f, (byte)75, 0, 0, true); //Stormwing
            SpawnEngine.getInstance().spawnObject(Stormwing, group.getGroupLeader().getInstanceId());
        }
		
        //When kills Stormwing spawn Exit
        if(monster.getObjectTemplate().getTemplateId() == 216183)
        {
            SpawnTemplate spawn;
            
            spawn = SpawnEngine.getInstance().addNewSpawn(300170000, group.getGroupLeader().getInstanceId(), 730286, 556.59375f, 1367.2274f, 224.79459f, (byte)0, 0, 0, true); //Exit
            SpawnEngine.getInstance().spawnObject(spawn, group.getGroupLeader().getInstanceId());
        }
    }
    
    public static BeshmundirInstanceService getInstance()
    {
        return SingletonHolder.instance;
    }
    
    @SuppressWarnings("synthetic-access")
    private static class SingletonHolder
    {
        protected static final BeshmundirInstanceService instance = new BeshmundirInstanceService();
    }
    
}
